package com.personal.system.controller.content.web;

import com.personal.common.result.Result;
import com.personal.system.entity.content.Message;
import com.personal.system.service.content.web.ApiMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/blog/v1/message")
@Api(tags = "评论留言接口")
@RequiredArgsConstructor
public class ApiMessageController {

    private final ApiMessageService messageService;

    @RequestMapping(value = "/",method = RequestMethod.GET)
    @ApiOperation(value = "留言列表", httpMethod = "GET", response = Result.class, notes = "留言列表")
    public Result selectMessageList(){
        return messageService.selectMessageList();
    }


    @RequestMapping(value = "/",method = RequestMethod.POST)
    @ApiOperation(value = "添加留言", httpMethod = "POST", response = Result.class, notes = "添加留言")
    public Result insertMessage(@RequestBody Message message){
        return messageService.insertMessage(message);
    }

}